public class DateUtil {
    public int year;
    public int month;
    public int day;

    public DateUtil() {
        //this(1999,9,9);
        System.out.println("不带参数的构造方法，这个方法如果没有写，Java会默认提供！");
    }
    public DateUtil(int year, int month, int day) {
        //this();
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("调用了带有3个参数的构造方法！");
    }

    public void setDate(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public void show() {
        System.out.println("年："+year+" 月："+month+" 日："+day);
    }

    public static void main(String[] args) {
        DateUtil dateUtil = new DateUtil();
        dateUtil.show();
    }
    public static void main2(String[] args) {
        DateUtil dateUtil = new DateUtil(2022,11,7);
        dateUtil.show();
    }

    public static void main1(String[] args) {
        DateUtil dateUtil = new DateUtil();
        dateUtil.setDate(2022,11,7);
        dateUtil.show();

        DateUtil dateUtil2 = new DateUtil();
        dateUtil2.setDate(2022,11,7);
        dateUtil2.show();

        DateUtil dateUtil3 = new DateUtil();
        dateUtil3.setDate(2022,11,7);
        dateUtil3.show();
    }



}
